All

Column

Assessments analytics by month of data collection

Date Observations Districts Partners
Oct 2018 346 58 14
Nov 2018 354 64 15
Dec 2018 359 65 15
Jan 2019 372 64 16
Feb 2019 350 63 15
Mar 2019 326 64 14
Apr 2019 289 49 12
May 2019 216 40 10
Jun 2019 201 39 10
Jul 2019 178 31 9
Aug 2019 171 34 10
Sep 2019 195 37 10
Oct 2019 199 37 9
Nov 2019 250 49 10
Dec 2019 192 35 7
Jan 2020 261 56 12
Feb 2020 256 54 11

Column

Number of partners involved in data collection

Number of KI assessed per month

Number of district assessed per month

North

Column

Assessments analytics by month of data collection

Date Observations Districts Partners
Oct 2018 223 37 12
Nov 2018 208 40 12
Dec 2018 192 39 13
Jan 2019 163 32 12
Feb 2019 163 33 11
Mar 2019 163 34 11
Apr 2019 139 26 8
May 2019 83 19 7
Jun 2019 73 18 7
Jul 2019 53 11 5
Aug 2019 65 15 8
Sep 2019 89 20 8
Oct 2019 89 19 7
Nov 2019 107 24 7
Dec 2019 78 18 6
Jan 2020 104 27 10
Feb 2020 111 26 8

Column

Number of partners involved in data collection

Number of KI assessed per month

Number of district assessed per month

South

Column

Assessments analytics by month of data collection

Date Observations Districts Partners
Oct 2018 62 6 3
Nov 2018 47 6 3
Dec 2018 57 7 4
Jan 2019 55 8 4
Feb 2019 42 7 4
Mar 2019 45 8 4
Apr 2019 42 7 3
May 2019 42 7 3
Jun 2019 42 7 3
Jul 2019 42 7 3
Aug 2019 42 7 3
Sep 2019 34 6 2
Oct 2019 40 6 2
Nov 2019 36 6 2
Dec 2019 33 4 1
Jan 2020 53 9 3
Feb 2020 48 9 3

Column

Number of partners involved in data collection

Number of KI assessed per month

Number of district assessed per month

Contested

Column

Assessments analytics by month of data collection

Date Observations Districts Partners
Oct 2018 61 15 7
Nov 2018 99 18 8
Dec 2018 110 19 7
Jan 2019 154 24 8
Feb 2019 145 23 7
Mar 2019 118 22 6
Apr 2019 108 16 5
May 2019 91 14 5
Jun 2019 86 14 5
Jul 2019 83 13 6
Aug 2019 64 12 5
Sep 2019 72 11 4
Oct 2019 70 12 4
Nov 2019 107 19 5
Dec 2019 81 13 5
Jan 2020 104 20 7
Feb 2020 97 19 7

Column

Number of partners involved in data collection

Number of KI assessed per month

Number of district assessed per month

---
title: "Monthly JMMI Partners Tracker"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    source_code: embed
    theme: journal
    logo: C:/Users/REACH_AO_YEMEN\Documents/REACH Yemen/2. Cash & Markets/7. JMMI_partners_tracker/logo/Asset1.png
    output: html_document

---

```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(kableExtra)
library(zoo)
library(plotly)
library(ggplot2)
library(dplyr)



## Load files <- only bit that needs to be updated
dt_gov <- read.csv("outputs/data_jmmi partners tracker_all_2020-04-22.csv", stringsAsFactors = F)
dt_gov$X <- NULL

dt_gov$Date <- as.yearmon(dt_gov$JMMI)

## Prepare dataset
table <- dt_gov %>% 
            dplyr::select(-c("district_ID", "governorate_ID", "governorate_name", "JMMI")) %>%
            group_by(Date) %>%
                    summarise(Observations = sum(org_num), Districts = n_distinct(district_name), Partners = n_distinct(org))

## Managing tooltips in ggplotly
## https://stackoverflow.com/questions/36325154/how-to-choose-variable-to-display-in-tooltip-when-using-ggplotly

## Line plot showing changes in engaged partners per month
plot1 <- ggplot(table, aes(as.Date(Date), Partners)) +
                  geom_line(color="red", size = 1) +
                  geom_point(color="red", size = 2, fill = NA) +
                  scale_shape(solid = FALSE) +
                  scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
                  ylab("Number of NGOs") +
                  xlab("Assessed Months")
                  theme_light()
                  
## Line plot showing changes in number of KIs assessed per month
plot2 <- ggplot(table, aes(as.Date(Date), Observations)) +
              geom_line(color="red", size = 1) +
              geom_point(color="red", size = 2, fill = NA) +
              scale_shape(solid = FALSE) +
              scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
              ylab("Total Observations") +
              xlab("Assessed Months")
              theme_light()    
                                
## Line plot showing changes in number of district assessed per month    
plot3 <- ggplot(table, aes(as.Date(Date), Districts)) +
              geom_line(color="red", size = 1) +
              geom_point(color="red", size = 2, fill = NA) +
              scale_shape(solid = FALSE) +
              scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
              ylab("Number of Districts") +
              xlab("Assessed Months")
              theme_light()         


```
All
=======================================================================

Column {data-width=350}
-----------------------------------------------------------------------

### **Assessments analytics by month of data collection**

```{r, results='asis'}

kable(table)%>%
 kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"),fixed_thead = T, full_width = T)

```

Column {data-width=650}
-----------------------------------------------------------------------

### **Number of partners involved in data collection**

```{r}

ggplotly(plot1, tooltip = c("Partners"))  

```

### **Number of KI assessed per month**

```{r}
  
ggplotly(plot2, tooltip = c("Observations")) 

```

### **Number of district assessed per month**

```{r}
              
ggplotly(plot3, tooltip = c("Districts")) 

```

North
=======================================================================
```{r, include=FALSE}
##  Take the main table and filter it by north
north <- filter(dt_gov, geo == "North")


n_table <- north %>% 
            dplyr::select(-c("district_ID", "governorate_ID", "governorate_name", "JMMI")) %>%
            group_by(Date) %>%
                    summarise(Observations = sum(org_num), Districts = n_distinct(district_name), Partners = n_distinct(org))


## Line plot showing changes in engaged partners by month
plot1n <- ggplot(n_table, aes(as.Date(Date), Partners)) +
                  geom_line(color="red", size = 1) +
                  geom_point(color="red", size = 2, fill = NA) +
                  scale_shape(solid = FALSE) +
                  scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
                  ylab("Number of NGOs") +
                  xlab("Assessed Months")
                  theme_light()
                  
## Line plot showing changes in number of KIs assessed by month
plot2n <- ggplot(n_table, aes(as.Date(Date), Observations)) +
              geom_line(color="red", size = 1) +
              geom_point(color="red", size = 2, fill = NA) +
              scale_shape(solid = FALSE) +
              scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
              ylab("Total Observations") +
              xlab("Assessed Months")
              theme_light()    
                                
## Line plot showing changes in number of district assessed by month    
plot3n <- ggplot(n_table, aes(as.Date(Date), Districts)) +
              geom_line(color="red", size = 1) +
              geom_point(color="red", size = 2, fill = NA) +
              scale_shape(solid = FALSE) +
              scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
              ylab("Number of Districts") +
              xlab("Assessed Months")
              theme_light()   


```

Column {data-width=350}
-----------------------------------------------------------------------

### **Assessments analytics by month of data collection**

```{r, results='asis'}

kable(n_table)%>%
 kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"),fixed_thead = T, full_width = T)

```

Column {data-width=650}
-----------------------------------------------------------------------

### **Number of partners involved in data collection**

```{r}

ggplotly(plot1n, tooltip = c("Partners"))  

```

### **Number of KI assessed per month**

```{r}
  
ggplotly(plot2n, tooltip = c("Observations")) 

```

### **Number of district assessed per month**

```{r}
              
ggplotly(plot3n, tooltip = c("Districts")) 

```

South
=======================================================================
```{r, include=FALSE}
##  Take the main table and filter it by south
south <- filter(dt_gov, geo == "South")

s_table <- south %>% 
            dplyr::select(-c("district_ID", "governorate_ID", "governorate_name", "JMMI")) %>%
            group_by(Date) %>%
                    summarise(Observations = sum(org_num), Districts = n_distinct(district_name), Partners = n_distinct(org))


## Line plot showing changes in engaged partners by month
plot1s <- ggplot(s_table, aes(as.Date(Date), Partners)) +
                  geom_line(color="red", size = 1) +
                  geom_point(color="red", size = 2, fill = NA) +
                  scale_shape(solid = FALSE) +
                  scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
                  ylab("Number of NGOs") +
                  xlab("Assessed Months")
                  theme_light()
                  
## Line plot showing changes in number of KIs assessed by month
plot2s <- ggplot(s_table, aes(as.Date(Date), Observations)) +
              geom_line(color="red", size = 1) +
              geom_point(color="red", size = 2, fill = NA) +
              scale_shape(solid = FALSE) +
              scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
              ylab("Total Observations") +
              xlab("Assessed Months")
              theme_light()    
                                
## Line plot showing changes in number of district assessed by month    
plot3s <- ggplot(s_table, aes(as.Date(Date), Districts)) +
              geom_line(color="red", size = 1) +
              geom_point(color="red", size = 2, fill = NA) +
              scale_shape(solid = FALSE) +
              scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
              ylab("Number of Districts") +
              xlab("Assessed Months")
              theme_light()   


```

Column {data-width=350}
-----------------------------------------------------------------------

### **Assessments analytics by month of data collection**

```{r, results='asis'}

kable(s_table)%>%
 kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"),fixed_thead = T, full_width = T)

```

Column {data-width=650}
-----------------------------------------------------------------------

### **Number of partners involved in data collection**

```{r}

ggplotly(plot1s, tooltip = c("Partners"))  

```

### **Number of KI assessed per month**

```{r}
  
ggplotly(plot2s, tooltip = c("Observations")) 

```

### **Number of district assessed per month**

```{r}
              
ggplotly(plot3s, tooltip = c("Districts")) 

```

Contested
=======================================================================
```{r, include=FALSE}
##  Take the main table and filter it by contested
cnt <- filter(dt_gov, geo == "Contested")

cnt_table <- cnt %>% 
            dplyr::select(-c("district_ID", "governorate_ID", "governorate_name", "JMMI")) %>%
            group_by(Date) %>%
                    summarise(Observations = sum(org_num), Districts = n_distinct(district_name), Partners = n_distinct(org))


## Line plot showing changes in engaged partners by month
plot1c <- ggplot(cnt_table, aes(as.Date(Date), Partners)) +
                  geom_line(color="red", size = 1) +
                  geom_point(color="red", size = 2, fill = NA) +
                  scale_shape(solid = FALSE) +
                  scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
                  ylab("Number of NGOs") +
                  xlab("Assessed Months")
                  theme_light()
                  
## Line plot showing changes in number of KIs assessed by month
plot2c <- ggplot(cnt_table, aes(as.Date(Date), Observations)) +
              geom_line(color="red", size = 1) +
              geom_point(color="red", size = 2, fill = NA) +
              scale_shape(solid = FALSE) +
              scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
              ylab("Total Observations") +
              xlab("Assessed Months")
              theme_light()    
                                
## Line plot showing changes in number of district assessed by month    
plot3c <- ggplot(cnt_table, aes(as.Date(Date), Districts)) +
              geom_line(color="red", size = 1) +
              geom_point(color="red", size = 2, fill = NA) +
              scale_shape(solid = FALSE) +
              scale_x_date(date_labels = "%b-%Y", date_breaks = "1 month") +
              ylab("Number of Districts") +
              xlab("Assessed Months")
              theme_light()   

```

Column {data-width=350}
-----------------------------------------------------------------------

### **Assessments analytics by month of data collection**

```{r, results='asis'}

kable(cnt_table)%>%
 kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"),fixed_thead = T, full_width = T)

```

Column {data-width=650}
-----------------------------------------------------------------------

### **Number of partners involved in data collection**

```{r}

ggplotly(plot1c, tooltip = c("Partners"))  

```

### **Number of KI assessed per month**

```{r}
  
ggplotly(plot2c, tooltip = c("Observations")) 

```

### **Number of district assessed per month**

```{r}
              
ggplotly(plot3c, tooltip = c("Districts")) 

```